package system

import (
	"context"
	"demo/api/backend/system/account"
	"demo/internal/service"
)

var (
	Account = cAccount{}
)

type cAccount struct{}

func (c *cAccount) GetList(ctx context.Context, req *account.GetListReq) (res *account.GetListRes, err error) {
	total, userList, err := service.Account().GetList(ctx)
	if err != nil {
		return
	}
	res = &account.GetListRes{
		Total: total,
		List:  userList,
	}
	return
}

func (c *cAccount) Add(ctx context.Context, req *account.AddReq) (res *account.AddRes, err error) {
	err = service.Account().Add(ctx, req)
	return
}

func (c *cAccount) Update(ctx context.Context, req *account.UpdateReq) (res *account.UpdateRes, err error) {
	err = service.Account().Update(ctx, req)
	return
}

func (c *cAccount) Sate(ctx context.Context, req *account.SateReq) (res *account.SateRes, err error) {
	err = service.Account().Sate(ctx, req)
	return
}
